package com.cyzy.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cyzy.dao.CourseCampus;
import com.cyzy.mapper.CourseManageMapper;
import com.cyzy.pojo.CourseCategory;
import com.cyzy.service.CourseManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseManageServiceImpl implements CourseManageService {

    @Autowired
    private CourseManageMapper courseManageMapper;

    @Override
    public Page<CourseCampus> selectAllCourse(CourseCampus courseCampus, int pageSize, int pageNum){
        Page<CourseCampus> page = new Page<>(pageNum, pageSize);
        return courseManageMapper.selectAllCourse(page,courseCampus);
    }

    @Override
    public List<CourseCategory> selectAllCategory(CourseCategory courseCategory){
        return courseManageMapper.selectAllCategory(courseCategory);
    }

    @Override
    public List<CourseCampus> getCourse(CourseCampus courseCampus){
        return courseManageMapper.getCourse(courseCampus);
    }

    @Override
    public int addCourse(CourseCampus courseCampus) {
        return courseManageMapper.addCourse(courseCampus);
    }

    @Override
    public int updateCourse(CourseCampus courseCampus) {
        return courseManageMapper.updateCourse(courseCampus);
    }

    @Override
    public int deleteCourse(List<Integer> courseIds) {
        return courseManageMapper.deleteCourse(courseIds);
    }

    @Override
    public int updateCourseStatus(CourseCampus courseCampus){
        return courseManageMapper.updateCourseStatus(courseCampus.getCourseId(),courseCampus.getCourseStatus());
    }



}




